<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 
    v-for

      语法：
        1. 针对数组
          v-for="(item, index) in xxx"
            item  - 数组的元素
            index - 数组元素对应的下标

        2. 针对对象
          v-for="(value, key, index) in xxx"
            value   - 键值
            key     - 键名
            index   - 下标

        3. 针对数字
          v-for="item in 5"
          v-for="item in [1, 2, 3, 4, 5]"
   -->

    <div id="app">
      <ul>
        <li v-for="(item, index) in list">{{ item }} - {{ index }}</li>
      </ul>
      <hr />

      <ul>
        <li v-for="(item, key, index) in person">
          {{ item }} - {{ key }} - {{index}}
        </li>
      </ul>

      <hr />

      <ul>
        <li v-for="(item, index) in 10">{{ item }} - {{index}}</li>
      </ul>
    </div>

    <script src="../../lib/vue3.js"></script>
    <script>
      Vue.createApp({
        data() {
          return {
            list: [1, 2, 3],
            person: {
              name: "张三",
              age: 18,
            },
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
